
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Bug解决的过程 - 学习卡片</title>
      <style>
        body { font-family: sans-serif; background-color: #f0f8ff; color: #333; display: flex; flex-direction: column; align-items: center; padding: 50px 20px; }
        .header h1 { font-size: 32px; }
        .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; width: 100%; max-width: 1200px; }
        .card-container { perspective: 1200px; cursor: pointer; height: 250px; }
        .card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.7s; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .card-container.flipped .card { transform: rotateY(180deg); }
        .card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; box-sizing: border-box; border-radius: 16px; background-color: #fff; padding: 24px; }
        .card-back { background-color: #f0fff4; transform: rotateY(180deg); justify-content: space-between; }
        .card-category { font-size: 14px; color: #0052d9; margin-bottom: 8px; font-weight: 500; }
        .card-question { font-size: 20px; font-weight: 500; flex-grow: 1; display: flex; align-items: center; justify-content: center; text-align: center; }
        .card-answer-wrapper { flex-grow: 1; overflow-y: auto; }
        .card-answer { font-size: 15px; line-height: 1.7; }
        .card-footer { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 16px; margin-top: 16px; }
        .card-source { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 12px; }
      </style>
    </head>
    <body>
      <div class="header">
        <h1>Bug解决的过程 - 学习卡片</h1>
      </div>
      <div class="grid-container">
        
    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">理论</div>
          <div class="card-question">MyBatis中的`org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)`异常通常意味着什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">理论</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">这是一个Mapper绑定异常，意味着MyBatis在调用Mapper接口中的方法时，未能找到该方法所对应的SQL语句。</div>
          </div>
          <div class="card-source">来源: bug分析</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">在MyBatis中，当我们调用一个Mapper接口的方法时，背后发生了什么来执行SQL？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">当我们调用Mapper接口中的方法时，MyBatis会为该接口创建一个代理类。通过这个代理类来调用方法，MyBatis才能找到并运行对应的SQL语句。</div>
          </div>
          <div class="card-source">来源: bug分析</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">MyBatis是如何将一个Mapper接口与其对应的XML文件进行绑定的？具体依赖哪个属性？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">通过在Mapper.xml文件中的`<mapper>`标签内设置`namespace`属性，该属性的值为需要绑定的接口的全类名，从而将两者绑定。</div>
          </div>
          <div class="card-source">来源: bug分析</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">在Mapper接口与XML文件绑定后，MyBatis如何将接口中的具体方法与XML中的SQL语句关联起来？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">通过确保Mapper接口中的方法名称与XML文件中SQL标签（如`<select>`, `<insert>`等）的`id`属性值保持一致，来完成方法和SQL语句的绑定。</div>
          </div>
          <div class="card-source">来源: bug分析</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">除了在Mapper.xml中未定义SQL语句外，还有哪些常见原因会导致`BindingException`？请列举至少两种。</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">1. Mapper.xml中的`namespace`属性写错；2. Mapper.java中的方法名称和Mapper.xml中SQL标签的`id`属性不一致；3. Mapper.xml文件没有被正确注册到MyBatis配置中。</div>
          </div>
          <div class="card-source">来源: bug解决</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">MyBatis的Mapper接口中的方法是否支持重载？为什么文档建议不要这样做？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">接口方法本身是可以重载的，但是Mapper.xml中的`id`是不允许重复的。由于通常将方法名用作`id`，重载会导致`id`冲突，因此建议不要重载Mapper方法。</div>
          </div>
          <div class="card-source">来源: bug解决</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">如果一个Mapper.xml文件内容完全正确，但程序运行时仍然报`BindingException`，可能是什么环境配置问题？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">可能是因为该Mapper.xml文件没有被正确地注册到MyBatis的配置中，导致MyBatis在启动时没有加载它。</div>
          </div>
          <div class="card-source">来源: bug解决</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">在MyBatis的Mapper.xml文件中，`namespace`属性配置错误会引发什么问题？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">如果`namespace`属性写错了，MyBatis将无法将XML文件与正确的Mapper接口进行绑定，从而在调用接口方法时找不到对应的SQL语句，抛出`BindingException`。</div>
          </div>
          <div class="card-source">来源: bug解决</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">文档中提到的学生遇到的`BindingException`的具体原因是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">该学生在Mapper接口中定义了方法，但是没有在对应的Mapper.xml文件中编写该方法所需的SQL语句，导致MyBatis找不到SQL而抛出异常。</div>
          </div>
          <div class="card-source">来源: bug分析</div>
        </div>
      </div>
    </div>

      </div>
    </body>
    </html>
